package model.posterminal.posterminalconnectiontype;

import java.util.ArrayList;

import model.ConfigData;
import model.database.ObjectDataProvider;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

@Root(name="posterminalconnectiontype")
public class PosterminalConnectionType extends ObjectDataProvider{
	

	@Attribute(name = "id")
	long id 	= ConfigData.NOVALUELONG;
	
	@Element(name = "posterminalconnectiontypename")
	String posterminalConnectionTypeName;
	
	/**
	 * Return database id of posterminal connection type
	 * @return
	 */
	public long getId() {
		return id;
	}
	
	/**
	 * Return posterminal connection type name
	 * @return
	 */
	public String getPosterminalConnectionType() {
		return posterminalConnectionTypeName;
	}

	/**
	 * Set posterminal connection type name
	 * @param posterminalConnectionType
	 */
	public void setPosterminalConnectionType(String posterminalConnectionType) {
		this.posterminalConnectionTypeName = posterminalConnectionType;
	}

	/**
	 * Save data
	 * @throws Exception
	 */
	public void Save() throws Exception{
		String storedProcedureName = "posTerminalConnectionTypeSave";
		
		if (this.id == ConfigData.NOVALUELONG) {
			this.id = ((PosterminalConnectionType) this.sendObject2GetObject(this, this.getClass(), storedProcedureName)).getId();
		}
		else {
			this.sendObject2GetListObject(this, this.getClass(), storedProcedureName);
		}
		
	}
	
	public ArrayList<PosterminalConnectionType> getAllPosterminalConnectionTypes() throws Exception {
		String storedProcedureName = "posTerminalConnectionTypeLoad";
		ArrayList<PosterminalConnectionType> result = new ArrayList<PosterminalConnectionType>();
		
		result = (ArrayList<PosterminalConnectionType>) this.sendObject2GetListObject(this, this.getClass(), storedProcedureName);
		
		return result;
	}

	
	
	
	

}
